import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '@/assets/style.css'
import { getUserInfo, isfullScreen } from './utils'


router.beforeEach((to, from, next) => {
    /* 路由发生变化修改页面title */
    if (to.meta.title) {
        document.title = to.meta.title;
    }
    if (localStorage.getItem('user') && !store.state.userlist) {
        let user = localStorage.getItem('user')
        getUserInfo(parseInt(user))
    }
    let off = isfullScreen()

    if (!off && to.fullPath != '/fullscreen' && !store.state.ShutFullscreen && to.fullPath != '/404' ||
        store.state.tourl && to.fullPath != '/fullscreen' && !off && !store.state.ShutFullscreen && to.fullPath != '/404') {

        store.commit('updataTourl', to.fullPath)

        router.push('/fullscreen')
    }
    next()
})


// require('./mock')

Vue.config.productionTip = false

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')